<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="java.util.List"%>
<%@page import="com.yaodian100.ec.coupon.entity.CouponItem"%>
<%@page import="java.text.DateFormat"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="org.apache.commons.lang.StringUtils"%>
<%@page import="com.yaodian100.core.common.utils.DateUtil"%>
<%@page import="org.apache.commons.lang.time.DateUtils"%>
<%@page import="java.util.Date"%>
<%@page import="com.yaodian100.core.common.utils.ServerValue"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<html>
<head>
<link rel="stylesheet" href="/css/jtips.css" type="text/css" id="" media="print, projection, screen" />
<script src="/js/jtip.js"></script>

<s:if test="%{coupon.applyRangeType == @com.yaodian100.ec.coupon.entity.Coupon$ApplyRangType@ALL}">
	<%-- 全館適用 --%>
	<s:if test="%{coupon.activityLink != null && coupon.activityLink != ''}">
		<%-- 有相關活動連結 --%>
		<script language="javascript">
			var applyRangDialogWidth = 450;
		</script>
	</s:if>
	<s:else>
		<%-- 沒有相關活動連結 --%>
		<script language="javascript">
			var applyRangDialogWidth = 400;
		</script>
	</s:else>
</s:if>
<s:else>
	<s:if test="%{coupon.activityLink != null && coupon.activityLink != ''}">
		<%-- 有相關活動連結 --%>
		<script language="javascript">
			var applyRangDialogWidth = 550;
		</script>
	</s:if>
	<s:else>
		<%-- 沒有相關活動連結 --%>
		<script language="javascript">
			var applyRangDialogWidth = 480;
		</script>
	</s:else>
</s:else>

<s:if test="%{applicableItemIdList != null && applicableItemIdList.size() > 10}">
	<script language="javascript">
		$().ready(function(){
			$("#applyRangeDialog").dialog({
				bgiframe: true
				,width: applyRangDialogWidth
				,height: 335
				,modal: true
				,resizable: true
			});
		});
	</script>
</s:if>
<s:else>
	<script language="javascript">
		$().ready(function(){
			$("#applyRangeDialog").dialog({
				bgiframe: true
				,width: applyRangDialogWidth
				,modal: true
				,resizable: true
			});
		});
	</script>
</s:else>

<style type="text/css">
    .alert-caution {
        overflow: auto;
    }
</style>

</head>
<body>
	<DIV id="applyRangeDialog" title="礼券适用范围说明"  class="alert-caution" style="display:none" >
		<!--全館-->
		<s:if test="%{coupon.applyRangeType == @com.yaodian100.ec.coupon.entity.Coupon$ApplyRangType@ALL}">
			<p>
				<strong class="txt-m">
					限折抵单件金额满<span class="txt-rd">${coupon.minimumProductPrice}</span>元，<a href="/" target="_blank">全站适用</a>。
				</strong>
				<s:if test="%{coupon.activityLink != null && coupon.activityLink != ''}">
					<span style="text-align:center;">
						<a href="${coupon.activityLink}" onFocus="this.blur()" target="_blank" class="btn-sp">相关活动</a>
					</span>
				</s:if>
			</p>
		</s:if>
		<!--限特定商品-->
		<s:if test="%{coupon.applyRangeType == @com.yaodian100.ec.coupon.entity.Coupon$ApplyRangType@PRODUCT}">
			<p>
				<strong class="txt-m">
					限折抵单件金额满<span class="txt-rd">${coupon.minimumProductPrice}</span>元，适用商品如下：
				</strong>
				<s:if test="%{coupon.activityLink != null && coupon.activityLink != ''}">
					<span style="text-align:center;">
						<a href="${coupon.activityLink}" onFocus="this.blur()" target="_blank" class="btn-sp">相关活动</a>
					</span>
				</s:if>
			</p>
			<ul class="w-L1">
				<s:iterator value="%{applicableItemIdList}" var="applicableItemId" >
					<li>
						<!--禮券適用限制為商品的時候，applicableItemIdList 裡放的是  productId-->
						<s:url id="productPageUrl" value="/product/product.do">
							<s:param name="productId" value="#applicableItemId"></s:param>
						</s:url>
						<s:a href="%{productPageUrl}" target="_blank" >
							<s:property value="%{productService.get(#applicableItemId).productName}" />
						</s:a>
					</li>
				</s:iterator>
			</ul>
		</s:if>
		<!--限特定館／類別-->
		<s:if test="%{coupon.applyRangeType == @com.yaodian100.ec.coupon.entity.Coupon$ApplyRangType@CATEGORY}">
			<p>
				<strong class="txt-m">
					限折抵单件金额满<span class="txt-rd">${coupon.minimumProductPrice}</span>元，适用商品馆/类别如下：
				</strong>
				<s:if test="%{coupon.activityLink != null && coupon.activityLink != ''}">
					<span style="text-align:center;">
						<a href="${coupon.activityLink}" onFocus="this.blur()" target="_blank" class="btn-sp">相关活动</a>
					</span>
				</s:if>
			</p>
			<ul class="w-L1">
				<s:iterator value="%{applicableItemIdList}" var="applicableItemId" >
					<li>
						<!--禮券適用限制為類別的時候，applicableItemIdList 裡放的是 categoryId-->
						<s:url id="categoryPageUrl" value="/category/category.do">
							<s:param name="z" value="#applicableItemId"></s:param>
						</s:url>
						<s:a href="%{categoryPageUrl}" target="_blank" >
							<s:property value="%{categoryService.makeCategorieURL(#applicableItemId,false)}" escape="false" />
						</s:a>
					</li>
				</s:iterator>
			</ul>
		</s:if>
		<div align="center"> <span style="text-align:center;"><a href="#" class="btn-mid" onClick="$(this).parents('div:eq(1)').dialog('close'); return false;" >关闭</a></span> </div> 
	</DIV>
		 
</body>
</html>